*** Replication materials for:
*** Cox, Gary W., Jon H. Fiva, and Daniel M. Smith
*** "The Contraction Effect: How Proportional Representation Affects Mobilization and Turnout"
*** The Journal of Politics

*** NOTE: Be advised that text encoding may result in some Norwegian characters displaying incorrectly.

local path="C:\Users\SETFILEPATH"
cd `path'
cap mkdir "`path'\tables"
cap mkdir "`path'\figures"
cap mkdir "`path'\figures\gph"
cap mkdir "`path'\log"

/* DATA PREPARATION */
run do/Turnout_District_Level /* generating SMD district level data set, using "final round" */
run do/Turnout_District_Level_ALT /* generating SMD district level data set , but using "first round turnout" */
run do/Turnout_District_Level_ALT_margin /* generating SMD district level data set , but using "first round turnout" */
run do/GS_prereform       /* Grofman-Selb Index of Competition pre-reform */
run do/AlternativeMargin  /* Grofman-Selb Index of Competition and Post-reform margin */
run do/AlternativeMargin2  /* Grofman-Selb Index of Competition and Post-reform margin */

/* TABLE 1: Model vs. Empirics */
*** nothing to replicate ***

/* TABLE 2: Pre-Reform Margin and Change in Turnout */ 
run do/Table2

/* TABLE 3: Sensitivity Analyses */
run do/Table3

/* Footnote 17: resampling methods of Cameron, Gelbach and Miller */
do do/wildboot

/* FIGURE 1: Pre-reform SMD and post-reform PR district boundaries */
ssc install shp2dta
ssc install spmap
run do/Figure1

/* FIGURE 2: Kernel Density Plot of Voter Turnout, Pre- and Post-Reform */
run do/Figure2

/* FIGURE 3: Voter Turnout 1909-1927 */
run do/Figure3

/* FIGURE 4: Kernel Density Plot of Margin, Pre- and Post-Reform */
run do/Figure4

/* FIGURE 5: Margin 1909-1927 */
run do/Figure5

/* FIGURE 6: Mean Voter Turnout 1909-1927 - Split by Mean 1909-1918 Margin */
run do/Figure6

/* FIGURE 7: Relationship Between Pre-Reform Margin and Change in Turnout */
run do/Figure7

/* FIGURE 8: Falsification Test: Linear Regression Model */
run do/Figure8

/* FIGURE A.1: Cross-sectional Voter Turnout Distributions 1909-1927 */
run do/FigureA1

/* FIGURE A.2: Frequency of Observations by Average Pre-Reform Margin */
run do/FigureA2

/* FIGURE A.3: Kernel Density Plot of Index of Competition, Pre- and Post-Reform */
run do/FigureA3

/* FIGURE A.4: Average Number of Parties Running 1909-1927 */
run do/FigureA4

/* TABLE A1: Sensitivity Analyses Based on Specifications with PR District FE */
run do/TableA1
